home *** CD-ROM | disk | FTP | other *** search
/ Trading on the Edge / Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin / pc / mac_file / vendor_d / neuralwa / nw2v50 / automate.txt < prev    next >
Text File  |  1993-08-23  |  21KB  |  445 lines

  1.  
  2.                    Documentation for the Automate Program
  3.  
  4.  
  5.       Automate is a NeuralWorks User-Control program used to train or
  6.       test networks in an off-line batch-processing mode.  It permits
  7.       multiple networks to be processed (trained or tested) overnight
  8.       without your direct intervention.  Automate requires version 5.0
  9.       of NeuralWorks Professional II/PLUS or NeuralWorks Explorer
  10.       software.
  11.  
  12.       Before running Automate you'll need to create it's data file
  13.       'automate.dat'.  This is an ASCII file that contains your tasks
  14.       for Automate to perform, and can be created using any text editor.
  15.  
  16.  
  17.    Task summary:
  18.  
  19.       Automate understands the tasks (commands) listed below.  Shown is
  20.       an example of each task, with square brackets denoting optional
  21.       entries.
  22.  
  23.       open mynet[.nnd]            ! open an existing network
  24.       savenet [newfile[.nnd]]     ! save the net (or save as)
  25.       learn 10000                 ! train a network
  26.       test                        ! test one pass/all
  27.       recall                      ! recall one pass/all
  28.       savebest 10000 500 10       ! savebest (train, test, auto-save)
  29.       savebest 10000 500 10 .95 2 ! savebest with auto-pruning
  30.       randomseed 257              ! reset the random number generator
  31.       initialize                  ! initialize the network
  32.       disable all                 ! disable each input PE and test
  33.       disable 2 3 4 5 6           ! disable specific input PE(s) & test
  34.       set learnfile train[.nna]   ! change the training filename
  35.       set recallfile test[.nna]   ! change the recall/test filename
  36.       set testfile test[.nna]     ! change the recall/test filename
  37.       set disable                 ! disable specific input PEs (no test)
  38.       holdout 1 3 .2              ! PNN & GRNN tests varying Sigma Scale
  39.  
  40.  
  41.    Program execution:
  42.  
  43.       The following is an outline of steps needing performed during an
  44.       Automate session:
  45.  
  46.       (1) Create and save a network using the Explorer or Professional
  47.       II/PLUS programs.  Make sure your data files exist along with your
  48.       network within the NeuralWorks directory.  You may want to partly
  49.       train or test the new network to ensure it functions properly.
  50.  
  51.       (2) Create or modify automate.dat using any text editor.  The file
  52.       should list the networks and tasks you wish to have performed.
  53.       Make sure this file is saved in ASCII text mode, without word-
  54.       processor formatting characters.
  55.  
  56.       (3) Start Automate running, perhaps waiting until later in the
  57.       evening.  The NeuralWorks Professional II/PLUS and NeuralWorks
  58.       Explorer command line to start a User-Control program varies
  59.       depending upon the machine you are using:
  60.  
  61.           nw2  -xuautomate    ! ProII/PLUS on Unix and 286 IBM-PC
  62.           nwe  -xuautomate    ! Explorer on Unix and IBM-PC
  63.           nw2x -xuautomate    ! ProII/PLUS on 386 and 486 IBM-PC
  64.           nw2s -xuautomate    ! ProII/PLUS on Solaris
  65.  
  66.       Automate is launched on a Macintosh by double-clicking on the
  67.       automate application icon or name.
  68.  
  69.       See your NeuralWorks System Guide for more details on creating,
  70.       compiling, or running User-Control programs.
  71.  
  72.       (4) After Automate execution, automate.dat contains 'Successful'
  73.       or 'FAILURE' comments at the start of each task it processed.
  74.       Checking automate.dat and nworks.err will indicate the cause of
  75.       any unexpected errors.
  76.  
  77.  
  78.    Usage Notes:
  79.  
  80.       Tasks can be abbreviated to their first 4 letters.  Savenet and
  81.       Savebest can be abbreviated to 5 letters.
  82.  
  83.       Before processing any tasks, Automate checks your automate.dat
  84.       file for syntax errors.  You are informed of any errors found and
  85.       processing aborts.  Automate.dat marks the lines in error with
  86.       'FAILURE' and a brief message about the nature of the error.
  87.       Processing begins only if no syntax errors are found.
  88.  
  89.       Automate execution can be interrupted by pressing the Escape key.
  90.       This halts the current task and (usually) asks whether processing
  91.       should continue with the next task or be halted completely.
  92.       Because the interrupted task is not completed, use this capability
  93.       with caution.
  94.  
  95.       The Learn task automatically saves the network, in binary format,
  96.       upon completion of training.  The currently opened network is
  97.       overwritten.  You may want to make a backup copy of the original
  98.       network before running Automate.
  99.  
  100.       Savebest also overwrites your current network and saves it in
  101.       binary format.  A savebest-log file (*.sbl) is automatically
  102.       written while this task is running.
  103.  
  104.       Savebest parameters in Automate are: Learn Count, Test Interval, #
  105.       Retries, Pruning Tolerance and Max # of PEs to Prune.  The two
  106.       pruning parameters need entered only if you wish to employ hidden
  107.       layer PE pruning.  See the NeuralWorks Reference Manual for more
  108.       information.  These parameters are space or comma delimited.
  109.  
  110.       Set Learnfile, Set Recallfile, and Set Testfile tasks change the
  111.       name of the Learn or Recall/Test file within the I/O Parameters
  112.       dialog.  This enables data processing from files other than those
  113.       originally saved in the network.  These tasks apply only to the
  114.       currently opened network, and if you save the network these
  115.       'alternate' filenames are saved in the I/O Parameters dialog.
  116.       These commands should probably not be used on networks that employ
  117.       a UserIO program during training and testing.
  118.  
  119.       The Open task clears previously entered Set commands, so any Set
  120.       tasks must follow and not precede an Open task.
  121.  
  122.       Automate's source code file automate.c is provided should you wish
  123.       to review or modify the program.  If you make changes that are
  124.       generally useful to others, please consider sending them to
  125.       NeuralWare.  We will inspect and test the modifications, and
  126.       possibly incorporate them into future versions.
  127.  
  128.  
  129.  
  130.       The remainder of this document discusses two special tasks,
  131.       'Disable' and 'Holdout'.  These are examples of the kind of useful
  132.       tasks than can be added into the program.
  133.  
  134.  
  135.    The Disable task:
  136.  
  137.       Automate includes a technique named 'Disable', which is a method
  138.       of analyzing a trained network to determine the importance of each
  139.       input variable.  It has the same purpose as the NeuralWorks
  140.       Run/Explain command, but with a whole different approach.  The
  141.       Disable task will disable one or more INPUT LAYER processing
  142.       elements, run a Test command, and record the R Correlation
  143.       measurement (from one or more Confusion Matrixes) into a file
  144.       named 'disable.log'.  This log file is appended to if it exists.
  145.  
  146.       Networks must be trained and specially setup for use with Disable,
  147.       as described later.
  148.  
  149.       Automate.dat for a Disable run might look like this:
  150.  
  151.           open mynet
  152.           disable 2 3    ! disable first 2 input PEs and test
  153.           disable 3 4 5  ! disable 2nd, 3rd, and 4th PE and test
  154.           disable all    ! disable each input PE one at a time,
  155.                            testing at each step.  Only 1 PE at a
  156.                            time is disabled using this task.
  157.  
  158.       Tasks 'disable every' and 'disable each' are synonyms for the
  159.       'disable all' task.
  160.  
  161.       Note that Disable does not save the network; it only opens it,
  162.       disables the specified input PEs, and runs a Test command to
  163.       determine the drop in output performance when this PE (or group of
  164.       PEs) is not providing input.  The specified PEs are marked as
  165.       disabled and their Output values are set to 0.0, effectively
  166.       removing this input node from the upcoming Test command.
  167.  
  168.  
  169.    Disable results:
  170.  
  171.       Below is the disable.log results file produced from the above
  172.       automate.dat file:
  173.  
  174.           !
  175.           ! network:  audisabl.nnd
  176.           ! sum R   ConfM1  ConfM2  ConfM3  %impact ---disabled PEs---
  177.            2.7676  0.9963  0.8605  0.9106   0.000  (baseline)
  178.            2.3815  0.9930  0.5518  0.8365  13.951  2 3
  179.            0.0739  0.6572  0.1017 -0.6850  97.328  3 4 5
  180.            2.7528  0.9887  0.8688  0.8953   0.531  2
  181.            2.3342  0.9846  0.4992  0.8503  15.657  3
  182.            2.0825  0.9073  0.5264  0.6487  24.753  4
  183.            0.8115  0.9253  0.4447 -0.5585  70.676  5
  184.  
  185.       This result is from a partially trained Back-propagation network
  186.       using iris_tra.nna and iris_tes.nna.  The network has 4 input PEs
  187.       (PEs 2, 3, 4, and 5) and 3 output PEs.
  188.  
  189.       The first column of figures is the sum of columns 2 through 4.
  190.  
  191.       Columns 2 through 4, labeled ConfM1, ConfM2 and ConfM3, show the R
  192.       correlation coefficient as displayed on a Confusion Matrix
  193.       instrument within the network.  There is one Confusion Matrix
  194.       graph per output PE.
  195.  
  196.       Column 5, labeled '%impact' shows the drop in network output
  197.       occurring when the input PEs (shown in column 6) were disabled.
  198.  
  199.       The first numeric line above is a 'baseline' test, ran before
  200.       disabling any input PEs. The baseline 'Sum R' is used by all
  201.       subsequent tests to calculate each test's %impact.  If the %impact
  202.       figure is negative, it indicates that the network results improved
  203.       by disable that PE (or group of PEs).  The calculation for %impact
  204.       is:
  205.  
  206.           %impact = 100.0 - (newTestSumR / BaselineSumR * 100.0);
  207.  
  208.       For example, disabling only input PE 2 (the first input PE) shows
  209.       a much smaller drop (0.531%) in the network's predictive or
  210.       classifying capability, relative to when PE 5 was disabled
  211.       (70.676%).  You might infer from this that PE 5's inputs are
  212.       substantially more important to the network, in a global sense,
  213.       than are PE 2's inputs.  Closer inspection of the entry for PE 5
  214.       also shows a much smaller affect on the first output class than on
  215.       the second and third outputs.
  216.  
  217.       If Disable results (or results from the Run/Explain command)
  218.       indicate that one or more inputs can be deleted with minimal
  219.       impact the network's performance, you should re-train a new
  220.       network without these inputs.  This will verify whether the inputs
  221.       are indeed unnecessary.
  222.  
  223.       For both Disable and the Run/Explain command, you might wish to
  224.       run separate tests using (1) the training file, (2) a test data
  225.       file, and/or (3) a combined file of training and test data.  The
  226.       combined file is likely to show a more global picture of things
  227.       than when testing only a subset of your data.
  228.  
  229.  
  230.    Network setup for Disable:
  231.  
  232.       The Disable task relies upon Confusion Matrix instruments to
  233.       calculate the R correlation value, and expects this information to
  234.       be found in a temporary file named 'disable.nnp'.  This is
  235.       accomplished within the network (after it is trained) by doing the
  236.       following:
  237.  
  238.       (1) For each output PE you are interested in monitoring, create a
  239.       Confusion Matrix instrument for that PE. Using the Graph/EasyProbe
  240.       icon, select "Output Value", "Selected PE", "Transform across
  241.       Epoch", "ConfM", and okay the dialog.  Apply the graph to the
  242.       output PE of interest, and repeat the process for all output PEs
  243.       you are interested in monitoring.
  244.  
  245.       (2) Edit each Confusion Matrix graph.  Select the "logging active"
  246.       button, and enter "disable" into the filename field.  The "append"
  247.       selection should be used, and not "write".  This will cause all
  248.       graphs to record their R values into disable.nnp.
  249.  
  250.       (3) VERY IMPORTANT: Unless you want very misleading results, make
  251.       sure that multiple Confusion Matrixes are edited in the 'proper
  252.       order'.  Graphs plot in the order they have been accessed in, and
  253.       so the logged values within disable.nnp will be in this same
  254.       order.  After setting up the graphs and editing their contents,
  255.       perform a Graph/Edit (or double-click) on each graph in sequence,
  256.       starting with the graph for the first output layer PE, then the
  257.       second graph, etc.  Simply bring up the Graph/Edit dialog and okay
  258.       it.  If in doubt, press the Escape key and the screen will
  259.       repaint.  Watch the order that the graphs appear; they should be
  260.       in a left-to-right fashion.
  261.  
  262.       (4) Do step 3, or the results will be very misleading and you
  263.       probably won't realize anything is wrong.
  264.  
  265.  
  266.    Specifying PE(s) to disable:
  267.  
  268.       Only Input layer PEs can be disabled using the Disable task.
  269.  
  270.       Up to 50 PEs can be disabled at one time, separated by spaces or
  271.       commas.
  272.  
  273.       The first PE in an Input layer is labeled "2" on the screen, and
  274.       is known as PE 2 (the "Bias" PE is PE 1, and it is not in the
  275.       Input layer).  Entering the number 2 into the PE-list therefore
  276.       disables PE 2, the first Input layer PE. Likewise, entering 100
  277.       disables PE 100, the 99th Input.
  278.  
  279.  
  280.    The Set Disable task:
  281.  
  282.       'Set Disable' is a special task with rather esoteric use.  Suppose
  283.       that after running Disable as shown above, you believe inputs 1
  284.       and 2 (PEs 2 and 3) are not contributing much to the output of the
  285.       network.  To verify this, these PEs need to be disabled, and the
  286.       network needs to be initialized and retrained.  You can either
  287.       disable the PEs manually within the Explorer or Professional
  288.       II/PLUS using PE/Edit, or you can use 'Set Disable'.  This setting
  289.       tells Automate to disable the PEs, without running any tests.  It
  290.       is assumed you will then Initialize and Train the network, or
  291.       'Savenet' the network.  Automate.dat for this task looks like
  292.       this:
  293.  
  294.           open mynet
  295.           set disable
  296.           disable 2       ! could be one command 'disable 2 3'
  297.           disable 3
  298.           savenet mynet2
  299.  
  300.  
  301.    The Holdout task:
  302.  
  303.       This task exists only for use with Probabilistic Neural Network
  304.       (PNN) and General Regression Neural Network (GRNN) paradigms, and
  305.       will not work for any other network type.  Due to these paradigms
  306.       using 1 hidden layer PE for every training data case, and because
  307.       they are often used when few data cases are available, they lend
  308.       themselves to a testing technique known as the 'hold-out' method.
  309.  
  310.       During 'hold-out', the network is trained with all data cases
  311.       except one which is used for test purposes.  The network results
  312.       are recorded, and the network is trained and tested holding out a
  313.       different data case.  The process repeats for each data case.
  314.  
  315.       Although this method may be valid for any paradigm when few data
  316.       cases are available, the topology of PNN and GRNN networks makes
  317.       this method very easy to automate, and does not even require
  318.       re-training the network.  After initially training the network,
  319.       only one pass through the data set is required while disabling the
  320.       appropriate 'pattern layer' PE for each data case.
  321.  
  322.       Automate's Holdout task differs a bit from the above description.
  323.       It is not primarily intended for use in situations with few data
  324.       cases.  Instead it is concerned with optimizing one of the L/R
  325.       Schedule coefficients, the Sigma Scale setting.  Holdout requires
  326.       three parameters (as explained later) to explore various Sigma
  327.       Scale settings, and produces results that indicate the
  328.       near-optimal value for this coefficient.
  329.  
  330.       Your network should be trained before using Holdout, and it must
  331.       not be using a UserIO program for training.
  332.  
  333.       Holdout works by running Test commands using single data cases
  334.       extracted from your training data file.  Your network may have a
  335.       separate Test data set, but the Test data is not used by Holdout.
  336.       Internally, Automate looks only at your training data.
  337.  
  338.  
  339.    Holdout parameters:
  340.  
  341.       The Holdout task parameters explore various Sigma Scale settings.
  342.       You supply the start, stop, and step size for this setting, and
  343.       Automate performs one Holdout task for each setting.  The three
  344.       arguments are entered space or comma delimited.
  345.  
  346.       If the first parameter (the starting Sigma) is entered as a
  347.       negative value, then the start and stop Sigma becomes an offset
  348.       from the network's current Sigma Scale setting.  A positive
  349.       starting Sigma is considered an absolute range; negative is an
  350.       offset, relative to the current Sigma Scale setting.
  351.  
  352.       For example, a task input line of 'holdout 1.0 3.1 0.5' will test
  353.       six different Sigma Scale coefficients {1.0, 1.5, 2.0, 2.5, 3.0,
  354.       3.1}, regardless of the Sigma Scale setting currently set within
  355.       the network.  A task input line of 'holdout -1.0 3.1 0.5' tests
  356.       ten different Sigma Scale coefficients.  If the network's current
  357.       setting is 4.0, then the tested settings are {3.0, 3.5, 4.0, 4.5,
  358.       5.0, 5.5, 6.0, 6.5, 7.0, 7.1}.  The minimum Sigma Scale tested is
  359.       0.0001, which is set by Automate if your range tries to set a
  360.       smaller value (Sigma Scale cannot be less than or equal to zero).
  361.  
  362.  
  363.    Holdout task results:
  364.  
  365.       The Holdout task causes Automate to perform a series of hold-out
  366.       tests rather quickly, and outputs an overall measure of the
  367.       network's performance into an output file named 'holdout.log'.
  368.       This file is appended to if it already exists.
  369.  
  370.       For PNN networks, this measure is the 'average classification
  371.       rate', the same measure as shown by our Classification Rate
  372.       instrument.  This instrument counts the percent-correct for each
  373.       output class, and reports the average of these scores.  A value of
  374.       0.0000 is terrible, and 1.0000 is a perfect score on all classes.
  375.       Further documentation for this instrument can be found under the
  376.       Graph Palette in the NeuralWorks Reference Manual.
  377.  
  378.       The measurement employed for GRNN networks is the root-mean-square
  379.       (RMS) of all errors.  A lower RMS error is better than a higher
  380.       one.
  381.  
  382.       Holdout.log results indicate whether you should continue to
  383.       increase or decrease the network's Sigma Scale setting, or whether
  384.       you should run additional experiments with smaller step sizes
  385.       (increments) to explore a more localized space.
  386.  
  387.       A sample automate.dat file for Holdout is shown below:
  388.  
  389.           open my_pnn
  390.           holdout .5 1.5 .2
  391.  
  392.       The resulting holdout.log file is shown below.  The results
  393.       indicate that the optimal Sigma Scale is somewhere between 0.5 and
  394.       0.9, and so additional Holdout tasks should be run in the range of
  395.       0.5 to 0.9, with a smaller step size.
  396.  
  397.           Holdout testing of network my_pnn
  398.           Sigma Scale varies from 0.5000 to 1.5000, stepped by 0.2000
  399.              avg classification rate = 0.7533, sigma scale = 0.5000
  400.              avg classification rate = 0.7936, sigma scale = 0.7000
  401.              avg classification rate = 0.7655, sigma scale = 0.9000
  402.              avg classification rate = 0.7412, sigma scale = 1.1000
  403.              avg classification rate = 0.7412, sigma scale = 1.3000
  404.              avg classification rate = 0.7384, sigma scale = 1.5000
  405.  
  406.       At completion, Holdout places the 'best' Sigma Scale value back
  407.       into the L/R Schedule.  Holdout does not alter your saved network,
  408.       unless automate.dat includes a Savenet task.  Saving the network
  409.       then writes the network with only the Sigma Scale coefficient
  410.       being different than the original network.
  411.  
  412.       And finally, consider the following automate.dat file:
  413.  
  414.           open my_pnn
  415.           holdout .5 1.5 .2
  416.           holdout -.4 .4 .05
  417.           holdout -.1 .1 .005
  418.           savenet my_pnn2
  419.  
  420.       The first Holdout task causes Automate to test between 0.5 and 1.5
  421.       as shown earlier, and a new Sigma Scale coefficient of 0.7 was
  422.       placed into the L/R Schedule (because 0.7 generated the highest
  423.       average classification rate).  The second Holdout task starts with
  424.       0.7, offsets this (because of -.4) and tests the range 0.3 to 1.1
  425.       with a smaller step size, again placing it's best Sigma Scale into
  426.       the L/R Schedule.  The third Holdout task potentially refines it
  427.       even further.  The Savenet task saves the network as 'my_pnn2.nnd'
  428.       with a fairly optimal Sigma Scale setting.
  429.  
  430.       If the Holdout task fails (i.e. 'FAILURE' is written into file
  431.       automate.dat), check nworks.err and also the holdout.log file to
  432.       determine the cause.
  433.  
  434.       Automate will run faster during Holdout tasks if the test data set
  435.       is loaded into Ram, and also if all on-screen graphs are turned
  436.       off during Recall mode.
  437.  
  438.       For more information on the 'hold-out' method and the Sigma Scale
  439.       coefficient, see the PNN and GRNN chapters in your Neural
  440.       Computing Guide, and the on-line help screen for the InstaNet menu
  441.       for these paradigms.
  442.  
  443.  
  444.    End of automate.txt
  445.